<!doctype html>
<html lang="en">
	<head>
		<head>
			<meta http-equiv='Content-Type' content='Type=text/html; charset=utf-8'>
			<title>Ruby Library - TNRoR</title>
			<link rel="stylesheet" href="styles.css" type="text/css" media="screen" />
			<link href="SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css">
			<%= stylesheet_link_tag "styles", :media => "screen" %>
			<%= stylesheet_link_tag "SpryMenuBarHorizontal", :media => "screen" %>
			<%= javascript_include_tag "equalcolumns", "http://code.jquery.com/jquery-latest.js", "SpryMenuBar" %>
		</head>
	</head>
	<body>
		<header>
			<h1> <%= image_tag "header.png", :alt => "f", :width => "960", :height => "150" %> </h1>
		</header>
		<ul id="MenuBar1" class="MenuBarHorizontal">
			<li>
				<%= link_to 'Trang Chủ', login_path, :class=>'MenuBarItemSubmenu'%>
			</li>
			<li>
				<a href="#" class="MenuBarItemSubmenu">Sách</a>
				<ul>
					<li >
						<a href="/newbooks/new" class="menustyle" >Sách mới</a>
					</li>
					<li>
						<a href="/hotbooks/new" class="menustyle" >Sách hay</a>
					</li>
					<li>
						<a href="/searchbooks/new" class="menustyle" >Tìm kiếm</a>
					</li>
				</ul>
			</li>
			<li>
				<a class="MenuBarItemSubmenu" href="/users/new">Tạo Tài khoản</a>
			</li>
			<li>
				<a href="#" class="MenuBarItemSubmenu">Liên Hệ</a>
			</li>
		</ul>
		<br>
		<br>
		<div id="innercontent">
			<header>
				<h2>Sách hay</h2>
			</header>
				
				<div class="hot_book_form">
					<% if flash[:notice] %>
					<p id="notice">
						<%= notice %>
					</p>
					<% end %>
					<% if flash[:alert] %>
					<p id="notice">
						<%= flash[:alert] %>
					</p>
					<% end %>
				</div>
			  <form accept-charset="UTF-8" action="/hotbooks/new?number=10" method="get">
			  	Sách hay
				<table >
					<tr height="30">
						<td width="20">
							<input id="number" name="number" size="25" type="text">
						</td>
						<td>
							<input type="submit" name="Searchbtn" id="Searchbtn" value="Tìm" class="buttonstyle">
						</td>
					</tr>
				</table>
			</form>
			<div class = "autopagerize_page_element">
			<% if @hotbooks.count > 0 %>
			<%= paginate @hotbooks %>
			<table>
				<tr>
					<th></th>
					<th></th>
					<th></th>
					<th></th>	
				</tr>
				<tr>
				<% for i in 0..(@hotbooks.count - 1) %>			
					<td width = "130" height="200" class:"center">
						<%= image_tag @hotbooks[i].link, :width => "120", :height => "160", :class =>"top" %>	
						<%= link_to @hotbooks[i].name, viewbooks_index_path(:book_id => @hotbooks[i].id) %> </td>
					<%if i%4 == 3%>
						</tr><tr>
					<%end%>
				<% end %>
				</tr>
				
			</table>
			
			<% else %>
					<% if flash[:notice] %>
					<p id="notice">
						<%= notice %>
						<%end %>
			<% end %>
		<% paginate @hotbooks %>
		</div>
		</div>
				
				
				
		</div>

		<aside>
			<section>
				<header>
					<h3>Tìm kiếm sách</h3>
				</header>
				<%= form_tag searchbooks_new_path(:search_option => 0), :method => :get do %>
				<p>
					<%= text_field_tag :search, params[:search], :size =>25 %>
					<input type="submit" name="Searchbtn" id="Searchbtn" value="Tìm" class="buttonstyle">
				</p>
				<% end %>
			</section>
			<section>
				<header>
					<h3>Đăng Nhập</h3>
				</header>
				<div class="login_form">
					<% if flash[:notice] %>
					<p id="notice">
						<%= notice %>
					</p>
					<% end %>
					<% if flash[:alert] %>
					<p id="notice">
						<%= flash[:alert] %>
					</p>
					<% end %>
				</div>
				<%= form_tag do %>
				<table width="260" border="0">
					<tr>
						<td width="71">Tài Khoản</td>
						<td width="179"><%= text_field_tag :name, params[:name],:size=>25 %></td>
					</tr>
					<tr>
						<td>Mật Khẩu</td>
						<td><%= password_field_tag :password, params[:password],:size=>25 %></td>
					</tr>
					<tr>
						<td colspan="2"> <%= submit_tag "Đăng Nhập", :name => "login",:class=>'buttonstyle' %>
						<%= submit_tag "Đăng Kí", :name =>  'signup', :class=>'buttonstyle' %></td>
					</tr>
					<tr>
						<td colspan="2"><%= link_to 'Quên Mật Khẩu?', new_forgotpas_path%></td>
					</tr>
				</table>
				<% end %>
			</section>
			<section>
				<header>
					<h3>Danh mục</h3>
				</header>
				<p>
					<% @categories.each do |item| %>
					- <%= link_to item.name + ' (' + item.books.size.to_s + ')', item %>
					<br>
					<% end %>
				</p>
			</section>
		</aside>
		<footer>
			<br />
			<p class="fcentered">
				------ Ruby Library - TNROR 2012 ------
				<br/>
			</p>
		</footer>
		<script type="text/javascript">
			var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {
				imgDown : "SpryAssets/SpryMenuBarDownHover.gif",
				imgRight : "SpryAssets/SpryMenuBarRightHover.gif"
			});
		</script>
	</body>
</html>

